/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package seso;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Polygon;

/**
 *
 * @author Administrator
 */
public class RDialogTabbedButton extends javax.swing.JButton {

    private String Text0 = "";
    private String Text1 = "";
    private String Text2 = "";
    private String Text3 = "";
    int[] xPoints = {4, 8, 4};
    int[] yPoints = {3, 6, 9};
    private Polygon polygon = new Polygon(xPoints, yPoints, 3);
    private boolean currentPanel = true;
    private boolean isBrightColor = true;
    private boolean isMouseEntered = false;

    public RDialogTabbedButton() {
        super();
        setText("");
        setBackground(new Color(244, 244, 244));
        setForeground(new Color(0, 101, 164));
        setFont(new Font("Arial", Font.PLAIN, 10));
        setBorder(null);
        setBorderPainted(false);
        setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        setFocusable(false);
        setSize(100, 39);
        setPreferredSize(new Dimension(100, 39));

        addMouseListener(new java.awt.event.MouseAdapter() {

            public void mouseEntered(java.awt.event.MouseEvent evt) {
                isMouseEntered = true;
                repaint();
            }

            public void mouseExited(java.awt.event.MouseEvent evt) {
                isMouseEntered = false;
                repaint();
            }
        });
    }

    @Override
    protected void paintComponent(Graphics g) {
        setText("");
        super.paintComponent(g);

        isBrightColor = isEnabled() && (isCurrentPanel() || isMouseEntered);

        Graphics2D g2d = (Graphics2D) g;
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        g2d.setColor((isBrightColor) ? new Color(0, 84, 157) : new Color(148, 175, 205));
        g2d.fillRoundRect(0, 0, 11, 24, 4, 4);

        g2d.setColor((isBrightColor) ? new Color(255, 255, 255) : new Color(96, 134, 174));
        g2d.fill(polygon);

        g2d.setFont(new Font("Arial", Font.PLAIN, 10));
        g2d.setColor(new Color(255, 255, 255));
        g2d.drawString(Text0, 2, 21);

        g2d.setColor((isBrightColor) ? new Color(0, 101, 164) : new Color(174, 179, 199));
        g2d.setFont(new Font("Arial", Font.PLAIN, 10));
        g2d.drawString(Text1, 18, 8);
        g2d.drawString(Text2, 18, 20);
        g2d.drawString(Text3, 18, 32);

    }

    /**
     * @return the Text1
     */
    public String getText1() {
        return Text1;
    }

    /**
     * @param Text1 the Text1 to set
     */
    public void setText1(String Text1) {
        this.Text1 = Text1;
    }

    /**
     * @return the Text2
     */
    public String getText2() {
        return Text2;
    }

    /**
     * @param Text2 the Text2 to set
     */
    public void setText2(String Text2) {
        this.Text2 = Text2;
    }

    /**
     * @return the Text3
     */
    public String getText3() {
        return Text3;
    }

    /**
     * @param Text3 the Text3 to set
     */
    public void setText3(String Text3) {
        this.Text3 = Text3;
    }

    /**
     * @return the Text0
     */
    public String getText0() {
        return Text0;
    }

    /**
     * @param Text0 the Text0 to set
     */
    public void setText0(String Text0) {
        this.Text0 = Text0;
    }

    /**
     * @return the currentPanel
     */
    public boolean isCurrentPanel() {
        return currentPanel;
    }

    /**
     * @param currentPanel the currentPanel to set
     */
    public void setCurrentPanel(boolean currentPanel) {
        this.currentPanel = currentPanel;
    }
}
